<?php
declare(strict_types=1);

use support\command\phinx\MigrationBaseClass;

final class CreateMenusTable extends MigrationBaseClass
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change(): void
    {
        $this->schema->create('menus', function (Illuminate\Database\Schema\Blueprint $table) {
            $table->increments('id');
            $table->enum('type', ['menu', 'btn'])->comment('类型:menu=菜单,btn=按钮');
            $table->integer('pid')->default(0)->comment('父级id');
            $table->string('pids')->default(0)->comment('父级id集合');
            $table->string('rule', 100)->comment('规则');
            $table->string('title', 200)->comment('标题');
            $table->string('icon', 200)->nullable(true)->comment('图标');
            $table->string('condition', 200)->nullable(true)->comment('额外参数');
            $table->string('remark', 200)->nullable(true)->comment('备注');
            $table->enum('status', ['normal', 'disibled', 'hidden'])->default('normal')->comment('状态:normal=正常,disibled=禁用,hidden=隐藏');
            $table->enum('target', ['_iframe', '_blank'])->default('_iframe')->comment('打开方式:_iframe=框架内打开,_blank=弹窗打开');
            $table->integer('weigh')->default(1000)->comment('权重');
            $table->timestamps();
        });
    }
}
